//
// Created by wuxiangan on 2022/4/19.
//

#ifndef LUI_THREADMESSAGE_H
#define LUI_THREADMESSAGE_H

#include "Common.h"

#define THREAD_MESSAGE_ACTION_ON_NONE 0x0
#define THREAD_MESSAGE_ACTION_ON_MOUSE 0x1
#define THREAD_MESSAGE_ACTION_ON_KEY 0x2
#define THREAD_MESSAGE_ACTION_ON_CHAR 0x4


class ThreadMessage {
public:
    ThreadMessage(uint32_t action = THREAD_MESSAGE_ACTION_ON_NONE): m_action(action) {}
    uint32_t GetAction() { return m_action; }

private:
    uint32_t m_action;
};

class MouseThreadMessage: public ThreadMessage {
public:
    MouseThreadMessage(): ThreadMessage(THREAD_MESSAGE_ACTION_ON_MOUSE) {
    }
private:
};

class KeyThreadMessage: public ThreadMessage {
public:
    KeyThreadMessage(std::string key): ThreadMessage(THREAD_MESSAGE_ACTION_ON_KEY) {
        m_key = key;
    }
    std::string& GetKey() { return m_key; }
private:
    std::string m_key;
};

class CharThreadMessage: public ThreadMessage {
public:
    CharThreadMessage(std::string commit_text): ThreadMessage(THREAD_MESSAGE_ACTION_ON_CHAR) {
        m_commit_text = commit_text;
    }
    std::string& GetCommitText() { return m_commit_text; }
private:
    std::string m_commit_text;
};

#endif //LUI_THREADMESSAGE_H
